home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / Fonts.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  8.1 KB  |  293 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Fonts.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Fonts;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __FONTS__}
  27. {$SETC __FONTS__ := 1}
  28.  
  29. {$I+}
  30. {$SETC FontsIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$PUSH}
  40. {$ALIGN MAC68K}
  41. {$LibExport+}
  42.  
  43. CONST
  44.     systemFont                    = 0;
  45.     applFont                    = 1;
  46.     newYork                        = 2;
  47.     geneva                        = 3;
  48.     monaco                        = 4;
  49.     venice                        = 5;
  50.     london                        = 6;
  51.     athens                        = 7;
  52.     sanFran                        = 8;
  53.     toronto                        = 9;
  54.     cairo                        = 11;
  55.     losAngeles                    = 12;
  56.     times                        = 20;
  57.     helvetica                    = 21;
  58.     courier                        = 22;
  59.     symbol                        = 23;
  60.     mobile                        = 24;
  61.     commandMark                    = 17;
  62.     checkMark                    = 18;
  63.     diamondMark                    = 19;
  64.  
  65.     appleMark                    = 20;
  66.     propFont                    = 36864;
  67.     prpFntH                        = 36865;
  68.     prpFntW                        = 36866;
  69.     prpFntHW                    = 36867;
  70.     fixedFont                    = 45056;
  71.     fxdFntH                        = 45057;
  72.     fxdFntW                        = 45058;
  73.     fxdFntHW                    = 45059;
  74.     fontWid                        = 44208;
  75.  
  76.  
  77. TYPE
  78.     FMInput = PACKED RECORD
  79.         family:                    INTEGER;
  80.         size:                    INTEGER;
  81.         face:                    Style;
  82.         needBits:                BOOLEAN;
  83.         device:                    INTEGER;
  84.         numer:                    Point;
  85.         denom:                    Point;
  86.     END;
  87.     FMOutput = PACKED RECORD
  88.         errNum:                    INTEGER;
  89.         fontHandle:                Handle;
  90.         boldPixels:                UInt8;
  91.         italicPixels:            UInt8;
  92.         ulOffset:                UInt8;
  93.         ulShadow:                UInt8;
  94.         ulThick:                UInt8;
  95.         shadowPixels:            UInt8;
  96.         extra:                    SInt8;
  97.         ascent:                    UInt8;
  98.         descent:                UInt8;
  99.         widMax:                    UInt8;
  100.         leading:                SInt8;
  101.         curStyle:                SInt8;
  102.         numer:                    Point;
  103.         denom:                    Point;
  104.     END;
  105.     FMOutPtr = ^FMOutput;
  106.  
  107.     FontRec = RECORD
  108.         fontType:                INTEGER;                                {font type}
  109.         firstChar:                INTEGER;                                {ASCII code of first character}
  110.         lastChar:                INTEGER;                                {ASCII code of last character}
  111.         widMax:                    INTEGER;                                {maximum character width}
  112.         kernMax:                INTEGER;                                {negative of maximum character kern}
  113.         nDescent:                INTEGER;                                {negative of descent}
  114.         fRectWidth:                INTEGER;                                {width of font rectangle}
  115.         fRectHeight:            INTEGER;                                {height of font rectangle}
  116.         owTLoc:                    INTEGER;                                {offset to offset/width table}
  117.         ascent:                    INTEGER;                                {ascent}
  118.         descent:                INTEGER;                                {descent}
  119.         leading:                INTEGER;                                {leading}
  120.         rowWords:                INTEGER;                                {row width of bit image / 2 }
  121.     END;
  122.     FMetricRec = RECORD
  123.         ascent:                    Fixed;                                    {base line to top}
  124.         descent:                Fixed;                                    {base line to bottom}
  125.         leading:                Fixed;                                    {leading between lines}
  126.         widMax:                    Fixed;                                    {maximum character width}
  127.         wTabHandle:                Handle;                                    {handle to font width table}
  128.     END;
  129.     FMetricRecPtr = ^FMetricRec;
  130.     FMetricRecHandle = ^FMetricRecPtr;
  131.  
  132.     WidEntry = RECORD
  133.         widStyle:                INTEGER;                                {style entry applies to}
  134.     END;
  135.     WidTable = RECORD
  136.         numWidths:                INTEGER;                                {number of entries - 1}
  137.     END;
  138.     AsscEntry = RECORD
  139.         fontSize:                INTEGER;
  140.         fontStyle:                INTEGER;
  141.         fontID:                    INTEGER;                                {font resource ID}
  142.     END;
  143.     FontAssoc = RECORD
  144.         numAssoc:                INTEGER;                                {number of entries - 1}
  145.     END;
  146.     StyleTable = RECORD
  147.         fontClass:                INTEGER;
  148.         offset:                    LONGINT;
  149.         reserved:                LONGINT;
  150.         indexes:                PACKED ARRAY [0..47] OF CHAR;
  151.     END;
  152.     NameTable = RECORD
  153.         stringCount:            INTEGER;
  154.         baseFontName:            Str255;
  155.     END;
  156.     KernPair = RECORD
  157.         kernFirst:                CHAR;                                    {1st character of kerned pair}
  158.         kernSecond:                CHAR;                                    {2nd character of kerned pair}
  159.         kernWidth:                INTEGER;                                {kerning in 1pt fixed format}
  160.     END;
  161.     KernEntry = RECORD
  162.         kernLength:                INTEGER;                                {length of this entry}
  163.         kernStyle:                INTEGER;                                {style the entry applies to}
  164.     END;
  165.     KernTable = RECORD
  166.         numKerns:                INTEGER;                                {number of kerning entries}
  167.     END;
  168.     WidthTable = PACKED RECORD
  169.         tabData:                ARRAY [0..255] OF Fixed;                {character widths}
  170.         tabFont:                Handle;                                    {font record used to build table}
  171.         sExtra:                    LONGINT;                                {space extra used for table}
  172.         style:                    LONGINT;                                {extra due to style}
  173.         fID:                    INTEGER;                                {font family ID}
  174.         fSize:                    INTEGER;                                {font size request}
  175.         face:                    INTEGER;                                {style (face) request}
  176.         device:                    INTEGER;                                {device requested}
  177.         inNumer:                Point;                                    {scale factors requested}
  178.         inDenom:                Point;                                    {scale factors requested}
  179.         aFID:                    INTEGER;                                {actual font family ID for table}
  180.         fHand:                    Handle;                                    {family record used to build up table}
  181.         usedFam:                BOOLEAN;                                {used fixed point family widths}
  182.         aFace:                    UInt8;                                    {actual face produced}
  183.         vOutput:                INTEGER;                                {vertical scale output value}
  184.         hOutput:                INTEGER;                                {horizontal scale output value}
  185.         vFactor:                INTEGER;                                {vertical scale output value}
  186.         hFactor:                INTEGER;                                {horizontal scale output value}
  187.         aSize:                    INTEGER;                                {actual size of actual font used}
  188.         tabSize:                INTEGER;                                {total size of table}
  189.     END;
  190.     FamRec = RECORD
  191.         ffFlags:                INTEGER;                                {flags for family}
  192.         ffFamID:                INTEGER;                                {family ID number}
  193.         ffFirstChar:            INTEGER;                                {ASCII code of 1st character}
  194.         ffLastChar:                INTEGER;                                {ASCII code of last character}
  195.         ffAscent:                INTEGER;                                {maximum ascent for 1pt font}
  196.         ffDescent:                INTEGER;                                {maximum descent for 1pt font}
  197.         ffLeading:                INTEGER;                                {maximum leading for 1pt font}
  198.         ffWidMax:                INTEGER;                                {maximum widMax for 1pt font}
  199.         ffWTabOff:                LONGINT;                                {offset to width table}
  200.         ffKernOff:                LONGINT;                                {offset to kerning table}
  201.         ffStylOff:                LONGINT;                                {offset to style mapping table}
  202.         ffProperty:                ARRAY [0..8] OF INTEGER;                {style property info}
  203.         ffIntl:                    ARRAY [0..1] OF INTEGER;                {for international use}
  204.         ffVersion:                INTEGER;                                {version number}
  205.     END;
  206.  
  207. PROCEDURE InitFonts;
  208.     {$IFC NOT GENERATINGCFM}
  209.     INLINE $A8FE;
  210.     {$ENDC}
  211. PROCEDURE GetFontName(familyID: INTEGER; VAR name: Str255);
  212.     {$IFC NOT GENERATINGCFM}
  213.     INLINE $A8FF;
  214.     {$ENDC}
  215. PROCEDURE GetFNum(name: ConstStr255Param; VAR familyID: INTEGER);
  216.     {$IFC NOT GENERATINGCFM}
  217.     INLINE $A900;
  218.     {$ENDC}
  219. FUNCTION RealFont(fontNum: INTEGER; size: INTEGER): BOOLEAN;
  220.     {$IFC NOT GENERATINGCFM}
  221.     INLINE $A902;
  222.     {$ENDC}
  223. PROCEDURE SetFontLock(lockFlag: BOOLEAN);
  224.     {$IFC NOT GENERATINGCFM}
  225.     INLINE $A903;
  226.     {$ENDC}
  227. FUNCTION FMSwapFont({CONST}VAR inRec: FMInput): FMOutPtr;
  228.     {$IFC NOT GENERATINGCFM}
  229.     INLINE $A901;
  230.     {$ENDC}
  231. PROCEDURE SetFScaleDisable(fscaleDisable: BOOLEAN);
  232.     {$IFC NOT GENERATINGCFM}
  233.     INLINE $A834;
  234.     {$ENDC}
  235. PROCEDURE FontMetrics(theMetrics: FMetricRecPtr);
  236.     {$IFC NOT GENERATINGCFM}
  237.     INLINE $A835;
  238.     {$ENDC}
  239. PROCEDURE SetFractEnable(fractEnable: BOOLEAN);
  240. FUNCTION GetDefFontSize: INTEGER;
  241.     {$IFC NOT GENERATINGCFM}
  242.     INLINE $3EB8, $0BA8, $6604, $3EBC, $000C;
  243.     {$ENDC}
  244. FUNCTION IsOutline(numer: Point; denom: Point): BOOLEAN;
  245.     {$IFC NOT GENERATINGCFM}
  246.     INLINE $7000, $A854;
  247.     {$ENDC}
  248. PROCEDURE SetOutlinePreferred(outlinePreferred: BOOLEAN);
  249.     {$IFC NOT GENERATINGCFM}
  250.     INLINE $7001, $A854;
  251.     {$ENDC}
  252. FUNCTION GetOutlinePreferred: BOOLEAN;
  253.     {$IFC NOT GENERATINGCFM}
  254.     INLINE $7009, $A854;
  255.     {$ENDC}
  256. FUNCTION OutlineMetrics(byteCount: INTEGER; textPtr: UNIV Ptr; numer: Point; denom: Point; VAR yMax: INTEGER; VAR yMin: INTEGER; awArray: FixedPtr; lsbArray: FixedPtr; boundsArray: RectPtr): OSErr;
  257.     {$IFC NOT GENERATINGCFM}
  258.     INLINE $7008, $A854;
  259.     {$ENDC}
  260. PROCEDURE SetPreserveGlyph(preserveGlyph: BOOLEAN);
  261.     {$IFC NOT GENERATINGCFM}
  262.     INLINE $700A, $A854;
  263.     {$ENDC}
  264. FUNCTION GetPreserveGlyph: BOOLEAN;
  265.     {$IFC NOT GENERATINGCFM}
  266.     INLINE $700B, $A854;
  267.     {$ENDC}
  268. FUNCTION FlushFonts: OSErr;
  269.     {$IFC NOT GENERATINGCFM}
  270.     INLINE $700C, $A854;
  271.     {$ENDC}
  272. FUNCTION GetSysFont : INTEGER;
  273.     {$IFC NOT CFMSYSTEMCALLS}
  274.     INLINE $3EB8, $0BA6;            { MOVE.W $0BA6,(SP) }
  275.     {$ENDC}
  276.  
  277. FUNCTION GetAppFont : INTEGER;
  278.     {$IFC NOT CFMSYSTEMCALLS}
  279.     INLINE $3EB8, $0984;            { MOVE.W $0984,(SP) }
  280.     {$ENDC}
  281.  
  282.  
  283. {$ALIGN RESET}
  284. {$POP}
  285.  
  286. {$SETC UsingIncludes := FontsIncludes}
  287.  
  288. {$ENDC} {__FONTS__}
  289.  
  290. {$IFC NOT UsingIncludes}
  291.  END.
  292. {$ENDC}
  293.